package it.pride.primefacesShowcase.service;

import it.pride.primefacesShowcase.model.User;
import org.springframework.stereotype.Service;

import javax.faces.bean.ApplicationScoped;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: eluibon
 * Date: 01/02/12
 * Time: 11.53
 */
@Service
@ApplicationScoped
public class HugeDatatableTestData {

    private SecureRandom random = new SecureRandom();

    private List<User> userList;

    public void init() {

        userList = new ArrayList<User>() ;

/*
        for (int i = 0; i < 100000; i++) {

            User user = new User(getRandomString(),getRandomString(),getRandomString(),getRandomString(),getRandomString(),getRandomString(),true) ;
            user.setId((long)i);
            userList.add(user) ;
        }
        * 
        */
    }


    private String getRandomString() {

        return new BigInteger(130, random).toString(10);
    }

    public List<User> getUserList() {
        return userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }
}
